home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows1 / al12xw.zip / AUTODIR.XWS next >
Text File  |  1991-01-23  |  29KB  |  649 lines

  1. /*
  2. CrossTalk for Windows AutoList Script
  3. (C) Ashley Saldanha
  4. 1/05/1991
  5. */
  6.  
  7. -- Initial off-line check.
  8.  
  9. LABEL CHECKON
  10.         activate
  11.         if not online or not connected then goto setup
  12.         message "AutoList error..."
  13.         topic="Error":mess="CrossTalk is already online.":b1="&Hangup":b2="&Cancel":gosub common2
  14.                 if choice=2 then end
  15.                 if choice=1 then bye:goto checkon
  16.         bye:goto setup
  17.  
  18. -- Script variables and default directory name parsing.  If no directory filename
  19. -- is specified on the command line, "AUTOLIST.DIR is loaded by default.  Error
  20. -- and dialog messages share common subroutines.
  21.  
  22. LABEL SETUP
  23.         integer icon,dirfile,nil,look,x,list
  24.         integer n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19
  25.         string d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19
  26.         string p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19
  27.         string y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16,y17,y18
  28.         string z1,z2,z3,z4,z5,z6,z7,z8,z9,z10,z11,z12,z13,z14,z15,z16,z17,z18
  29.         string dirname,defxwp,defdesc,dump,current,topic,mess,b1,b2
  30.         string num,xwpdir,ddesc,scrap,y,z,listdir
  31.         nil=true
  32.         look=true
  33.         eoln=chr(13)+chr(10)
  34.         curshape=0
  35.         y=" - "
  36.         dirname=arg(1)
  37.         if null(dirname) then dirname="autolist.dir"
  38.         current=upcase(dirname)
  39.         xwpdir=dirxwp
  40.         dirname=dirxwp+"\"+dirname
  41.         if length(dirxwp)>13 then xwpdir=left(dirxwp,13)
  42.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,12)
  43.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,11)
  44.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,10)
  45.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,9)
  46.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,8)
  47.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,7)
  48.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,6)
  49.         xwpdir=upcase(xwpdir)+"..."
  50.         goto read_dir
  51.  
  52. -- Create and/or read directory list file and add hyphen to description.
  53.  
  54. LABEL READ_DIR
  55.         new
  56.         if not exists(dirname) then {
  57.                 message "Compiling directory list, please wait..."
  58.                 dirfile=freefile
  59.                 open output dirname as dirfile
  60.                 close dirfile
  61.                 scrap=filefind(dirxwp + "\*.xwp")
  62.                 while not null(scrap) 
  63.                         load scrap
  64.                         if not null(number) then {
  65.                                 defxwp=name:defdesc=description
  66.                                 open append dirname as dirfile
  67.                                 write dirfile,defxwp,defdesc
  68.                                 }
  69.                         close dirfile
  70.                         scrap=filefind
  71.                 wend:new
  72.                 }
  73.         dirfile=freefile
  74.         if dirfile=0 then {
  75.                 message "Error..."
  76.                 topic="Error":mess="Try re-installing AutoList.":gosub common1:end
  77.                 }
  78.         message "Reading directory list, please wait..."
  79.         open input dirname as dirfile
  80.         while not eof(dirfile)
  81.                 read #dirfile,p1,d1,p2,d2,p3,d3,p4,d4,p5,d5,p6,d6,p7,d7,p8,d8,p9,d9,p10,d10,p11,d11,p12,d12,p13,d13,p14,d14,p15,d15,p16,d16,p17,d17,p18,d18
  82.                 if not eof then topic="Alert":mess="Maximum of 18 entries allowed per list.":gosub common1:goto page1
  83.         wend
  84.         close dirfile:cls
  85.         if not null(p1) then z1=y+d1 else z1=d1
  86.         if not null(p2) then z2=y+d2 else z2=d2
  87.         if not null(p3) then z3=y+d3 else z3=d3
  88.         if not null(p4) then z4=y+d4 else z4=d4
  89.         if not null(p5) then z5=y+d5 else z5=d5
  90.         if not null(p6) then z6=y+d6 else z6=d6
  91.         if not null(p7) then z7=y+d7 else z7=d7
  92.         if not null(p8) then z8=y+d8 else z8=d8
  93.         if not null(p9) then z9=y+d9 else z9=d9
  94.         if not null(p10) then z10=y+d10 else z10=d10
  95.         if not null(p11) then z11=y+d11 else z11=d11
  96.         if not null(p12) then z12=y+d12 else z12=d12
  97.         if not null(p13) then z13=y+d13 else z13=d13
  98.         if not null(p14) then z14=y+d14 else z14=d14
  99.         if not null(p15) then z15=y+d15 else z15=d15
  100.         if not null(p16) then z16=y+d16 else z16=d16
  101.         if not null(p17) then z17=y+d17 else z17=d17
  102.         if not null(p18) then z18=y+d18 else z18=d18
  103.         goto page1
  104.  
  105. -- First page dialog.  Dialogs were designed with Excel's Dialog Editor
  106. -- and depart as little as possible from CrossTalk's native dialog boxes.
  107.  
  108. LABEL PAGE1
  109.         message "AutoList Phone Book (pg.1)"
  110.         dialogbox 25,16,270,132
  111.                 ltext 8,2,208,8,"Phone Book Entries in "+xwpdir+"\"+current
  112.                 groupbox 8,10,208,118,""
  113.                 checkbox 12,16,170,12,upcase(p1)+z1,n1,tabstop focus
  114.                 checkbox 12,28,170,12,upcase(p2)+z2,n2,tabstop
  115.                 checkbox 12,40,170,12,upcase(p3)+z3,n3,tabstop
  116.                 checkbox 12,52,170,12,upcase(p4)+z4,n4,tabstop
  117.                 checkbox 12,64,170,12,upcase(p5)+z5,n5,tabstop
  118.                 checkbox 12,76,170,12,upcase(p6)+z6,n6,tabstop
  119.                 checkbox 12,88,170,12,upcase(p7)+z7,n7,tabstop
  120.                 checkbox 12,100,170,12,upcase(p8)+z8,n8,tabstop
  121.                 checkbox 12,112,170,12,upcase(p9)+z9,n9,tabstop
  122.                 defpushbutton 225,14,36,17,"&Dial",ok,tabstop group
  123.                 pushbutton 225,34,36,17,"PgD&n",tabstop
  124.                 pushbutton 225,54,17,14,"&+",tabstop
  125.                 pushbutton 244,54,17,14,"&-",tabstop
  126.                 pushbutton 225,71,36,17,"&Manual",tabstop
  127.                 pushbutton 225,91,36,17,"&Options",tabstop
  128.                 pushbutton 225,111,36,17,"&Close",cancel,tabstop
  129.         enddialog
  130.         if choice=7 then goto finish    
  131.         if choice=6 then goto options
  132.         if choice=5 then goto manual
  133.         if choice=4 then goto untag
  134.         if choice=3 then goto tag1
  135.         if choice=2 then goto page2
  136.         if choice=1 then goto checklist
  137.         goto page1
  138.  
  139. -- Second page dialog.  Additional "pages" are easily added, but increase
  140. -- the number of variables that must be stored, with predictable consequences
  141. -- on the execution speed of the script.
  142.  
  143. LABEL PAGE2
  144.         message "AutoList Phone Book (pg.2)"
  145.         dialogbox 25,16,270,132
  146.                 ltext 8,2,208,8,"Phone Book Entries in "+xwpdir+"\"+current
  147.                 ctext 225,2,36,8,"(Page 2)"
  148.                 groupbox 8,10,208,118,""
  149.                 checkbox 12,16,170,12,upcase(p10)+z10,n10,tabstop
  150.                 checkbox 12,28,170,12,upcase(p11)+z11,n11,tabstop
  151.                 checkbox 12,40,170,12,upcase(p12)+z12,n12,tabstop
  152.                 checkbox 12,52,170,12,upcase(p13)+z13,n13,tabstop
  153.                 checkbox 12,64,170,12,upcase(p14)+z14,n14,tabstop
  154.                 checkbox 12,76,170,12,upcase(p15)+z15,n15,tabstop
  155.                 checkbox 12,88,170,12,upcase(p16)+z16,n16,tabstop
  156.                 checkbox 12,100,170,12,upcase(p17)+z17,n17,tabstop
  157.                 checkbox 12,112,170,12,upcase(p18)+z18,n18,tabstop
  158.                 defpushbutton 225,14,36,17,"&Dial",ok,tabstop group
  159.                 pushbutton 225,34,36,17,"Pg&Up",tabstop
  160.                 pushbutton 225,54,17,14,"&+",tabstop
  161.                 pushbutton 244,54,17,14,"&-",tabstop
  162.                 pushbutton 225,71,36,17,"&Manual",tabstop
  163.                 pushbutton 225,91,36,17,"&Options",tabstop
  164.                 pushbutton 225,111,36,17,"&Close",cancel,tabstop
  165.         enddialog
  166.         if choice=7 then goto finish    
  167.         if choice=6 then goto options
  168.         if choice=5 then goto manual
  169.         if choice=4 then goto untag
  170.         if choice=3 then goto tag2
  171.         if choice=2 then goto page1
  172.         if choice=1 then goto checklist
  173.  
  174. -- The options dialog.  There is a limit on the number of characters that
  175. -- the list box can display at one time, and the final entry is blank.
  176.  
  177. LABEL OPTIONS
  178.         listdir=""
  179.         scrap=filefind(dirxwp+"\*.dir")
  180.         repeat
  181.                 listdir=listdir+scrap+","
  182.                 scrap=filefind
  183.         until null(scrap) or (length(listdir)>240) 
  184.         scrap=filefind(dirxwp+"\*.xwp")
  185.         repeat
  186.                 listdir=listdir+scrap+","
  187.                 scrap=filefind
  188.         until null(scrap) or (length(listdir)>240) 
  189.         message "AutoList Options"
  190.         dialogbox 25,16,270,132
  191.                 groupbox 6,4,150,122,""
  192.                 ctext 14,4,135,8,"CrossTalk for Windows AutoList"
  193.                 ctext 8,20,145,8,"Release 1.2"
  194.                 ctext 8,29,145,8,"Copyright ⌐ 1991, Ashley Saldanha"
  195.                 ctext 8,45,145,8,"AutoList is freeware.  It may"
  196.                 ctext 8,53,145,8,"be freely used and distributed."
  197.                 ctext 8,61,145,8,"Please direct comments and"
  198.                 ctext 8,69,145,8,"donations to:"
  199.                 ctext 8,85,145,8,"EnTech"
  200.                 ctext 8,93,145,8,"RFD 1, Box 555"
  201.                 ctext 8,101,145,8,"Orr's Island, Maine  04066"
  202.                 ctext 8,112,145,8,"CIS 72677,2370"
  203.                 listbox 160,9,62,65,listdir,list,tabstop
  204.                 groupbox 160,75,62,51,"Options"
  205.                 radiobutton 163,86,40,12,"N&ormal",nil,tabstop group
  206.                 radiobutton 163,99,42,12,"Mi&nimize",icon,tabstop 
  207.                 checkbox 163,112,40,12,"&Watch",look,tabstop
  208.                 defpushbutton 228,8,36,17,"&Open",tabstop group
  209.                 pushbutton 228,28,36,17,"&Cancel",cancel,tabstop focus
  210.                 pushbutton 228,48,36,17,"C&ompile",tabstop
  211.                 pushbutton 228,68,36,17,"&Edit",tabstop
  212.                 pushbutton 228,88,36,17,"&New",tabstop group
  213.                 pushbutton 228,108,36,17,"&Delete",tabstop
  214.         enddialog
  215.         if choice=1 then {
  216.                 dump=slice(listdir,list,",")
  217.                 if length(dump)=0 then goto options
  218.                 if right(dump,4)=".XWP" then scrap=dump:goto single
  219.                 dirname=dump
  220.                 current=upcase(dirname)
  221.                 dirname=dirxwp+"\"+dirname:goto read_dir
  222.                 }
  223.         if choice=2 then goto page1
  224.         if choice=3 then goto recompile
  225.         if choice=4 then goto edit1
  226.         if choice=5 then goto newdir
  227.         if choice=6 then {
  228.                 dump=slice(listdir,list,",")
  229.                 if length(dump)=0 then goto options
  230.                 message "Press [ESC] to cancel."
  231.                 topic="Confirm":mess="Delete  "+dump+"  ?":b1="&Ok":b2="&Cancel":gosub common2
  232.                 if choice=2 then goto options
  233.                 dump=dirxwp+"\"+dump
  234.                 if exists(dump) then delete dump:goto options
  235.                 }
  236.  
  237. -- Manual dial dialog.  Rather than dial the number immediately, the script
  238. -- assign a temporary variable (n19) to the number so that it may be inserted
  239. -- into a queue, and recalled at a later point in a session.
  240.  
  241. LABEL MANUAL
  242.         message "Press [ESC] to cancel."
  243.         dialogbox 45,60,232,19
  244.                 checkbox 3,3,28,12,"&Dial ",n19,tabstop
  245.                 edittext 31,3,64,12,z,d19,focus
  246.                 ltext 101,5,88,12,"with default settings"
  247.                 defpushbutton 194,3,36,14,"Ok",ok,tabstop
  248.         enddialog
  249.         if choice=1 then {
  250.                 if length(d19)=7 then d19=left(d19,3)+"-"+right(d19,4)
  251.                 if length(d19)=11 then d19=left(d19,1)+"-"+right(d19,10):d19=left(d19,5)+"-"+right(d19,7):d19=left(d19,9)+"-"+right(d19,4)
  252.                 z=d19
  253.                 p19=d19
  254.                 if n19=false then {
  255.                         if length(p19)=0 then goto page1
  256.                         new
  257.                         redialcount=99
  258.                         description=p19+" (manual entry)"
  259.                         trap on
  260.                         dial p19:if connected then alarm:show:display=on:end
  261.                         if error then topic="Alert":mess="No connection or call cancelled.":gosub common1:trap off:goto page1
  262.                         trap off:goto page1
  263.                         }       
  264.                 if length(p19)=0 then topic="Error":mess="No number entered.":gosub common1:goto manual
  265.                 goto page1
  266.                 }
  267.         else goto page1
  268.  
  269. -- New directory list prompt dialog, on a profile-by-profile basis.
  270.  
  271. LABEL INCLUDE
  272.         dirfile=freefile
  273.         open output dirname as dirfile
  274.         close dirfile
  275.         open input dirname as dirfile
  276.         scrap=filefind(dirxwp + "\*.xwp")
  277.         while not null(scrap) 
  278.                 message "Press [ESC] to edit manually."
  279.                 dialogbox 85,36,155,72
  280.                         groupbox 7,4,94,63,"Options"
  281.                         ltext 12,20,84,40,"Include  "+scrap+"  in new directory list?"
  282.                         defpushbutton 111,8,36,17,"&Yes",ok,tabstop,focus
  283.                         pushbutton 111,29,36,17,"&No",tabstop
  284.                         pushbutton 111,50,36,17,"&Cancel",cancel,tabstop
  285.                 enddialog
  286.                 if choice=3 then close dirfile:goto read_dir
  287.                 if choice=1 then {
  288.                         load scrap
  289.                         defxwp=name:defdesc=description
  290.                         open append dirname as dirfile
  291.                         write dirfile,defxwp,defdesc
  292.                         }
  293.                 close dirfile:new
  294.                 scrap=filefind
  295.         wend
  296.         new
  297.         close dirfile:cls
  298.         new:return
  299.  
  300. -- First page of the edit dialog.  Variables are copied to avoid loss of
  301. -- changes when switching from page to page.
  302.  
  303. LABEL EDIT1
  304.         y10=p10:y11=p11:y12=p12:y13=p13:y14=p14:y15=p15:y16=p16:y17=p17:y18=p18
  305.         z10=d10:z11=d11:z12=d12:z13=d13:z14=d14:z15=d15:z16=d16:z17=d17:z18=d18
  306.         message "AutoList Editor (pg.1)"
  307.         dialogbox 36,16,250,132
  308.                 edittext 4,4,39,12,p1,y1,tabstop focus
  309.                 edittext 48,4,158,12,d1,z1,tabstop
  310.                 edittext 4,18,39,12,p2,y2,tabstop
  311.                 edittext 48,18,158,12,d2,z2,tabstop
  312.                 edittext 4,32,39,12,p3,y3,tabstop
  313.                 edittext 48,32,158,12,d3,z3,tabstop
  314.                 edittext 4,46,39,12,p4,y4,tabstop
  315.                 edittext 48,46,158,12,d4,z4,tabstop
  316.                 edittext 4,60,39,12,p5,y5,tabstop
  317.                 edittext 48,60,158,12,d5,z5,tabstop
  318.                 edittext 4,74,39,12,p6,y6,tabstop
  319.                 edittext 48,74,158,12,d6,z6,tabstop
  320.                 edittext 4,88,39,12,p7,y7,tabstop
  321.                 edittext 48,88,158,12,d7,z7,tabstop
  322.                 edittext 4,102,39,12,p8,y8,tabstop
  323.                 edittext 48,102,158,12,d8,z8,tabstop
  324.                 edittext 4,116,39,12,p9,y9,tabstop
  325.                 edittext 48,116,158,12,d9,z9,tabstop
  326.                 ctext 210,2,36,8,"(Page 1)"
  327.                 defpushbutton 210,29,36,17,"&Save",ok,tabstop group
  328.                 pushbutton 210,49,36,17,"Pg&Dn",tabstop
  329.                 pushbutton 210,69,36,17,"&Editor",tabstop
  330.                 pushbutton 210,89,36,17,"&Cancel",tabstop
  331.         enddialog
  332.         if choice=4 then goto read_dir
  333.         if choice=3 then goto edit3
  334.         if choice=2 then {
  335.                 p1=y1:p2=y2:p3=y3:p4=y4:p5=y5:p6=y6:p7=y7:p8=y8:p9=y9
  336.                 d1=z1:d2=z2:d3=z3:d4=z4:d5=z5:d6=z6:d7=z7:d8=z8:d9=z9
  337.                 goto edit2
  338.                 }
  339.         if choice=1 then gosub writelist
  340.         goto read_dir
  341.  
  342. -- Second page of the edit dialog.
  343.  
  344. LABEL EDIT2
  345.         message "AutoList Editor (pg.2)"
  346.         dialogbox 36,16,250,132
  347.                 edittext 4,4,39,12,p10,y10,tabstop focus
  348.                 edittext 48,4,158,12,d10,z10,tabstop
  349.                 edittext 4,18,39,12,p11,y11,tabstop
  350.                 edittext 48,18,158,12,d11,z11,tabstop
  351.                 edittext 4,32,39,12,p12,y12,tabstop
  352.                 edittext 48,32,158,12,d12,z12,tabstop
  353.                 edittext 4,46,39,12,p13,y13,tabstop
  354.                 edittext 48,46,158,12,d13,z13,tabstop
  355.                 edittext 4,60,39,12,p14,y14,tabstop
  356.                 edittext 48,60,158,12,d14,z14,tabstop
  357.                 edittext 4,74,39,12,p15,y15,tabstop
  358.                 edittext 48,74,158,12,d15,z15,tabstop
  359.                 edittext 4,88,39,12,p16,y16,tabstop
  360.                 edittext 48,88,158,12,d16,z16,tabstop
  361.                 edittext 4,102,39,12,p17,y17,tabstop
  362.                 edittext 48,102,158,12,d17,z17,tabstop
  363.                 edittext 4,116,39,12,p18,y18,tabstop
  364.                 edittext 48,116,158,12,d18,z18,tabstop
  365.                 ctext 210,2,36,8,"(Page 2)"
  366.                 defpushbutton 210,29,36,17,"&Save",ok,tabstop group
  367.                 pushbutton 210,49,36,17,"Pg&Up",tabstop
  368.                 pushbutton 210,69,36,17,"&Editor",tabstop
  369.                 pushbutton 210,89,36,17,"&Cancel",tabstop
  370.         enddialog
  371.         if choice=4 then goto read_dir
  372.         if choice=3 then goto edit3
  373.         if choice=2 then {
  374.                 p10=y10:p11=y11:p12=y12:p13=y13:p14=y14:p15=y15:p16=y16:p17=y17:p18=y18
  375.                 d10=z10:d11=z11:d12=z12:d13=z13:d14=z14:d15=z15:d16=z16:d17=z17:d18=z18
  376.                 goto edit1
  377.                 }
  378.         if choice=1 then gosub writelist
  379.         goto read_dir
  380.  
  381. -- Writes directory list changes.
  382.  
  383. LABEL WRITELIST
  384.         if exists(dirname) then delete dirname
  385.         if not exists(dirname) then {
  386.                 message "Updating directory list, please wait..."
  387.                 dirfile=freefile
  388.                 open output dirname as dirfile
  389.                 close dirfile
  390.                 open append dirname as dirfile
  391.                 write dirfile,y1,z1
  392.                 write dirfile,y2,z2
  393.                 write dirfile,y3,z3
  394.                 write dirfile,y4,z4
  395.                 write dirfile,y5,z5
  396.                 write dirfile,y6,z6
  397.                 write dirfile,y7,z7
  398.                 write dirfile,y8,z8
  399.                 write dirfile,y9,z9
  400.                 write dirfile,y10,z10
  401.                 write dirfile,y11,z11
  402.                 write dirfile,y12,z12
  403.                 write dirfile,y13,z13
  404.                 write dirfile,y14,z14
  405.                 write dirfile,y15,z15
  406.                 write dirfile,y16,z16
  407.                 write dirfile,y17,z17
  408.                 write dirfile,y18,z18
  409.                 close dirfile
  410.                 }
  411.         return
  412.  
  413. -- Loads editor specified in the CrossTalk "System" options; if none
  414. -- exists, then attempts to load the Windows Notepad.
  415.  
  416. LABEL EDIT3
  417.         message "Loading editor, please wait..."
  418.         if null(editor) then run "notepad.exe "+dirname
  419.         else run editor+" "+dirname:end
  420.  
  421. -- Rewrites the current directory by deleting the filename and then 
  422. -- chaining to the Include subroutine above. 
  423.  
  424. LABEL RECOMPILE
  425.         message "Press [ESC] to cancel."
  426.         topic="Confirm":mess="Erase current directory list and recompile?":b1="&Ok":b2="&Cancel":gosub common2
  427.         if choice=2 then goto options
  428.         if choice=1 then {
  429.                 if exists(dirname) then delete dirname
  430.                 gosub include:goto read_dir
  431.                 }
  432.  
  433. -- First page global tag.  Only "real" entries are tagged.
  434.  
  435. LABEL TAG1
  436.         if length(p1)>0 then n1=true:if length(p2)>0 then n2=true:if length(p3)>0 then n3=true
  437.         if length(p4)>0 then n4=true:if length(p5)>0 then n5=true:if length(p6)>0 then n6=true
  438.         if length(p7)>0 then n7=true:if length(p8)>0 then n8=true:if length(p9)>0 then n9=true
  439.         goto page1
  440.  
  441. -- Second page global tag.
  442.  
  443. LABEL TAG2
  444.         if length(p10)>0 then n10=true:if length(p11)>0 then n11=true:if length(p12)>0 then n12=true
  445.         if length(p13)>0 then n13=true:if length(p14)>0 then n14=true:if length(p15)>0 then n15=true
  446.         if length(p16)>0 then n16=true:if length(p17)>0 then n17=true:if length(p18)>0 then n18=true
  447.         goto page2
  448.  
  449. -- Untags all entries.
  450.  
  451. LABEL UNTAG
  452.         n1=false:n2=false:n3=false:n4=false:n5=false:n6=false:n7=false:n8=false:n9=false
  453.         n10=false:n11=false:n12=false:n13=false:n14=false:n15=false:n16=false:n17=false:n18=false
  454.         n19=false
  455.         goto page1
  456.  
  457. -- Verifies profile and goes online, then chains to the Start subroutine below with
  458. -- the actual number and description listed in the profile.  If the "profile"
  459. -- passed is a manually entered number (p19), default communications parameters are used.
  460.  
  461. LABEL TEST
  462.         recycleseconds=15
  463.         if num=p19 then {
  464.                 new
  465.                 number=p19
  466.                 ddesc=number+" (manual entry)"
  467.                 goto init
  468.                 }
  469.         if inbook(num) then load num else topic="Error":mess="Cannot find "+num+".":gosub common1:goto page1
  470.         if look=false then display=off else display=on
  471.         ddesc=description
  472.         message "Dialing "+ddesc
  473.         trap on
  474.         go
  475.         watch 5 seconds for
  476.                 "OK":wait 1 second:goto start
  477.         endwatch:topic="Error":mess="Probable modem problem.":gosub common1:goto page1
  478.         
  479. -- The recycling subroutine itself, which sends the active profile name to
  480. -- the Test subroutine above.  The counter is arbitrarily set to 99 retries.
  481.  
  482. LABEL QUEUE
  483.         if icon=true then minimize
  484.         while not online or not connected {
  485.                 repeat
  486.                         x=x+1
  487.                         if n1=true then num=p1:gosub test
  488.                         if n2=true then num=p2:gosub test
  489.                         if n3=true then num=p3:gosub test
  490.                         if n4=true then num=p4:gosub test
  491.                         if n5=true then num=p5:gosub test
  492.                         if n6=true then num=p6:gosub test
  493.                         if n7=true then num=p7:gosub test
  494.                         if n8=true then num=p8:gosub test
  495.                         if n9=true then num=p9:gosub test
  496.                         if n10=true then num=p10:gosub test
  497.                         if n11=true then num=p11:gosub test
  498.                         if n12=true then num=p12:gosub test
  499.                         if n13=true then num=p13:gosub test
  500.                         if n14=true then num=p14:gosub test
  501.                         if n15=true then num=p15:gosub test
  502.                         if n16=true then num=p16:gosub test
  503.                         if n17=true then num=p17:gosub test
  504.                         if n18=true then num=p18:gosub test
  505.                         if n19=true then num=p19:gosub test
  506.                 until x=99
  507.                 alarm:alarm:alarm:show
  508.                 topic="Alert":mess="No connections were made.":gosub common1:cls:new:goto page1
  509.                 }
  510.         wend
  511.  
  512. -- The actual direct-address modem dialing routine and results watch.  The direct-
  513. -- address approach must be used when multiple numbers have been selected to inhibit
  514. -- the foreground appearance of CrossTalk's "Dialing - " message box when CrossTalk
  515. -- is running as a background task; otherwise relative transparency in background
  516. -- cycling through profiles would not be possible.
  517. -- Thanks to S. Jenkins for sharing his superior number parsing routine with me.
  518.  
  519. LABEL START
  520.         reply modeminit
  521.         scrap=upcase(number)
  522.         if instr(scrap,';') then scrap=slice(scrap,1,';')
  523.         if instr(scrap,'X') then scrap=strip(scrap,'X')
  524.         else if instr(scrap,'L') then scrap=ldnumber+strip(scrap,'L')
  525.                 else scrap=outnumber+scrap
  526.         if instr(dialprefix,'AT') then scrap=insert(dialprefix,modifier,instr(dialprefix,'AT')+2)+scrap+dialsuffix
  527.         else scrap=dialprefix+scrap+dialsuffix
  528.         reply scrap;
  529.         watch for
  530.                 "CONNECT":goto bingo
  531.                 "BUSY":message "Busy":return
  532.                 "NO CARRIER":message "No Carrier":return
  533.                 "NO DIAL":topic="Error":mess="No dial tone.":gosub common1:cls:new:goto page1
  534.                 "ERROR":topic="Error":mess="Probable modem problem.":gosub common1:cls:new:goto page1
  535.                 KEY 27:show:message "Dialing queue cancelled, please wait...":bye:n19=false:cls:new:goto page1
  536.         endwatch
  537.         trap off:bye
  538.                 
  539. -- This routine uses CrossTalk's native "call" or "dial" statements, in the
  540. -- event only a single number or profile has been selected.
  541.   
  542. LABEL SINGLE
  543.         trap on
  544.         if exists(scrap) then load scrap else new:redialcount=99
  545.         if length(number)>0 then {
  546.                 dial number
  547.                 if connected then alarm:alarm:alarm:show:chain script:end
  548.                 trap off:goto page1
  549.                 }
  550.         else call scrap
  551.         if connected then end else new:goto page1
  552.         
  553. -- This subroutine checks whether one or more selections have been made and
  554. -- then chains to the appropriate Single or multiple Queue subroutine above.
  555.  
  556. LABEL CHECKLIST
  557.         x=0
  558.         if n1=true and length(p1)>0 then x=x+1:scrap=p1
  559.         if n2=true and length(p2)>0 then x=x+1:scrap=p2
  560.         if n3=true and length(p3)>0 then x=x+1:scrap=p3
  561.         if n4=true and length(p4)>0 then x=x+1:scrap=p4
  562.         if n5=true and length(p5)>0 then x=x+1:scrap=p5
  563.         if n6=true and length(p6)>0 then x=x+1:scrap=p6
  564.         if n7=true and length(p7)>0 then x=x+1:scrap=p7
  565.         if n8=true and length(p8)>0 then x=x+1:scrap=p8
  566.         if n9=true and length(p9)>0 then x=x+1:scrap=p9
  567.         if n10=true and length(p10)>0 then x=x+1:scrap=p10
  568.         if n11=true and length(p11)>0 then x=x+1:scrap=p11
  569.         if n12=true and length(p12)>0 then x=x+1:scrap=p12
  570.         if n13=true and length(p13)>0 then x=x+1:scrap=p13
  571.         if n14=true and length(p14)>0 then x=x+1:scrap=p14
  572.         if n15=true and length(p15)>0 then x=x+1:scrap=p15
  573.         if n16=true and length(p16)>0 then x=x+1:scrap=p16
  574.         if n17=true and length(p17)>0 then x=x+1:scrap=p17
  575.         if n18=true and length(p18)>0 then x=x+1:scrap=p18
  576.         if n19=true and length(p19)>0 then x=x+1:scrap=p19
  577.         if x=0 then topic="Alert":mess="No number(s) selected.":gosub common1:goto page1
  578.         if x=1 then goto single
  579.         if x>1 then goto queue
  580.  
  581.  
  582. -- The create new directory list dialog box.
  583.  
  584. LABEL NEWDIR
  585.         message "Press [ESC] to cancel."
  586.         dialogbox 45,60,232,19
  587.                 ltext 3,5,28,12,"Create "
  588.                 edittext 31,3,39,12,z,dump,focus
  589.                 ltext 73,5,98,12,".DIR as a new directory."
  590.                 defpushbutton 194,3,36,14,"Ok",ok,tabstop
  591.         enddialog
  592.         if choice=1 then {
  593.                 if length(dump)=0 then goto options
  594.                 if length(dump)>8 then {
  595.                         topic="Error":mess="Invalid file name.":gosub common1:goto newdir
  596.                         }
  597.         else dump=upcase(dump)+".DIR"
  598.         dirname=dump
  599.         current=upcase(dirname)
  600.         dirname=dirxwp+"\"+dirname
  601.         gosub include:goto read_dir
  602.         
  603. -- The global single button message box.
  604.  
  605. LABEL COMMON1
  606.         dialogbox 85,36,155,72
  607.                 groupbox 7,4,94,63,topic
  608.                 ltext 12,20,84,40,mess
  609.                 defpushbutton 111,27,36,17,"&Ok",ok,tabstop,focus
  610.         enddialog
  611.         return
  612.  
  613. -- The global two-button dialog box.
  614.  
  615. LABEL COMMON2
  616.         dialogbox 85,36,155,72
  617.                 groupbox 7,4,94,63,topic
  618.                 ltext 12,20,84,40,mess
  619.                 defpushbutton 111,17,36,17,b1,ok,tabstop,focus
  620.                 pushbutton 111,41,36,17,b2,cancel,tabstop
  621.         enddialog
  622.         return
  623.  
  624. -- Connection made subroutine restores CrossTalk to the foreground and 
  625. -- its original window size if iconized, and terminates the script.
  626.  
  627. LABEL BINGO
  628.         restore
  629.         message "Connected to "+ddesc
  630.         alarm:alarm:alarm
  631.         chain script:end
  632.  
  633. -- The exit options dialog box.
  634.  
  635. LABEL FINISH
  636.         if connected then bye
  637.         display=on
  638.         cls
  639.         message "AutoList Exit Options"
  640.         dialogbox 85,36,155,72
  641.                 ctext 10,8,133,11,"Close AutoList and exit to:"
  642.                 defpushbutton 10,47,134,18,"&Cancel",cancel,tabstop,focus
  643.                 pushbutton 10,24,63,18,"Cross&Talk",tabstop
  644.                 pushbutton 81,24,63,18,"&Windows",tabstop
  645.         enddialog
  646.         if choice=1 then goto page1
  647.         if choice=2 then new:end
  648.         if choice=3 then terminate
  649.